//
//  BaseViewController.m
//  Nav
//
//  Created by dingzhibing on 2017/11/9.
//  Copyright © 2017年 dingzhibing. All rights reserved.
//

#import "BaseViewController.h"
#import "Defines.h"

@interface BaseViewController ()
@property (strong, nonatomic) UIView *navBackView;
@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navBackView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, NavHeight)];
    self.navBackView.backgroundColor = [UIColor colorWithRed:150.0/255 green:150.0/255 blue:100.0/255 alpha:0.9];
    self.navBackView.alpha = 0;
    [self.view addSubview:self.navBackView];
}

- (void)hideNav {
    [self.navBackView setHidden:YES];
}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    CGFloat alpha = scrollView.contentOffset.y / 150.0;
    self.navBackView.alpha = alpha;
}

@end
